package net.sky.oa.model;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Type;

/**
 * 日志表
 * TalBlog. @author hond
 */
@Entity
@Table(name = "TAL_BLOG")//日志表
public class TalBlog implements java.io.Serializable {

	private static final long serialVersionUID = 5673991033245515351L;
	
	// Fields

	protected Long id;
	private Integer type;          //日志类型：个人日志、工作日志
	private String title;       //日志标题
	private String content;     //日志内容
	private Date createtime;    //写日志时间
	private Integer ispublic;   //是否公开：1是2否
	private Integer peoplecount;//查阅人数
	private Integer isforward;  //是否转载：1是2否
	private Integer isreview;   //支付评论：1是2否
	private Integer istop;      //是否置顶：1是2否
	private SysEmployee user;     //发表人

	// Constructors

	/** default constructor */
	public TalBlog() {
	}
	
	@Id
    @Column(name = "ID", unique = true, nullable = false)
	@SequenceGenerator(name="SQ_TALBLOG_ID",sequenceName="SQ_TALBLOG_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_TALBLOG_ID")
	public Long getId() {
        return id;
    }

    public void setId(Long id){
    	this.id = id;
    }

	/** minimal constructor */
	public TalBlog(Long id) {
		this.id = id;
	}
	
	@Column(name = "TYPE", precision = 2, scale = 0)
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "TITLE", length = 60)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
    
	@Lob
    @Basic(fetch = FetchType.EAGER)
    @Column(name = "CONTENT", columnDefinition = "CLOB", nullable = true)
    @Type(type ="org.springframework.orm.hibernate3.support.ClobStringType")
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATETIME")
	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "ISPUBLIC", precision = 1, scale = 0)
	public Integer getIspublic() {
		return this.ispublic;
	}

	public void setIspublic(Integer ispublic) {
		this.ispublic = ispublic;
	}

	@Column(name = "PEOPLECOUNT", precision = 5, scale = 0)
	public Integer getPeoplecount() {
		return this.peoplecount;
	}

	public void setPeoplecount(Integer peoplecount) {
		this.peoplecount = peoplecount;
	}

	@Column(name = "ISFORWARD", precision = 1, scale = 0)
	public Integer getIsforward() {
		return this.isforward;
	}

	public void setIsforward(Integer isforward) {
		this.isforward = isforward;
	}

	@Column(name = "ISREVIEW", precision = 1, scale = 0)
	public Integer getIsreview() {
		return this.isreview;
	}

	public void setIsreview(Integer isreview) {
		this.isreview = isreview;
	}

	@Column(name = "ISTOP", precision = 1, scale = 0)
	public Integer getIstop() {
		return this.istop;
	}

	public void setIstop(Integer istop) {
		this.istop = istop;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "USER_ID")
	public SysEmployee getUser() {
		return this.user;
	}

	public void setUser(SysEmployee user) {
		this.user = user;
	}

}